﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S.Eartag.API.Application.Command.MarkedConditionCommand;

namespace S.Eartag.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class MarkedConditionController : ControllerBase
    {
        private readonly IMediator mediator;

        public MarkedConditionController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 羊只戴标-添加
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> MarkedConditionCreate(MarkedConditionCreateCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 羊只戴标-修改
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPut]
        public  async Task<int> MarkedConditionUpdate(MarkedConditionUpdateCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 羊只戴标-删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        [HttpDelete]
        public async Task<int> MarkedConditionDelete([FromQuery]MarkedConditionDeleteCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<int> MarkedConditionAlldel([FromQuery]MarkedConditionAlldelCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
